<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.active{
				color: #FF0000;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<ul>
				<li v-for="(item, index) in movies" :class="{active:activeName == index}" @click="switchActive(index)">{{index}}--{{item}}</li>
			</ul>
		</div>
	</body>
	<script type="text/javascript">
		const app = new Vue({
			el:'#app',
			data:{
				movies:['海王','海尔兄弟','火影忍者','进击的巨人'],
				activeName:''
			},
			methods:{
				switchActive:function(index){
					this.activeName = index;
				}
			}
		})
	</script>
</html>
